package MyLinkedList;

public class Test {
    public static void main(String[] args) {
        MyLinkedList linkedList = new MyLinkedList();

        // 添加元素
        linkedList.addFirst(1);
        linkedList.addLast(2);
        linkedList.addLast(3);
        linkedList.addLast(4);
        linkedList.addLast(5);
        linkedList.addLast(6);
        linkedList.addIndex(1, 3);

        // 遍历并显示链表元素
        linkedList.display();

        // 测试其他功能
        System.out.println("Size: " + linkedList.size());
        System.out.println("Contains 2: " + linkedList.contains(2));

        // 删除元素
        linkedList.remove(3);
        linkedList.removeAllKey(2);

        // 清空链表
        linkedList.clear();

        // 遍历并显示链表元素
        linkedList.display();
    }
}


